home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / gas-211 / gas / config / mips-opc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-30  |  24.8 KB  |  657 lines

  1. /*
  2.  * @OSF_COPYRIGHT@
  3.  */
  4. /*
  5.  * HISTORY
  6.  * $Log: mips-opcode.h,v $
  7.  * Revision 1.1  1993/02/08  19:20:26  raeburn
  8.  * from Ralph Campbell's work
  9.  *
  10.  * Revision 1.10.1.2  1992/02/05  21:37:06  kmk
  11.  *    Defined the M_LA_AB enumeral in support of the "la t,A(b)"
  12.  *    instruction.
  13.  *
  14.  *    Eliminated the abbreviated patterns employing the v, w, r,
  15.  *    V, and W specifiers.  The meaning of these specifiers has been
  16.  *    changed to represent an optional register in a single pattern.
  17.  *
  18.  * Revision 1.10  1991/05/22  15:50:46  devrcs
  19.  *    Remove unnecessary macros.  No longer need a special macro to do 32-bit
  20.  *    operands for instructions that specify 16-bit immediates.
  21.  *    Modify the way delays are done.  Missing some coprocessor instruction delay slots.
  22.  *    [91/05/07  09:34:07  duthie]
  23.  *
  24.  *    Bob Setzer fixes + mtcN opcode table fixes
  25.  *    [91/03/06  14:37:06  boot]
  26.  *
  27.  *    Merged changes from Bob Setzer.
  28.  *    [90/11/14  16:02:22  boot]
  29.  *
  30.  *    Fixed several problems including bad code generated for the slt,sltu,
  31.  *    bal, bgezal and bltzal instructions. Also the delay problem with the
  32.  *    mfhi and mflo instructions.
  33.  *    [90/10/11  16:42:42  setzer]
  34.  *
  35.  * Revision 1.7  90/10/07  21:01:04  devrcs
  36.  *    fixed bug 1231 l.d Illegal operands.
  37.  *    Also implemented similar missing macros.
  38.  *    [90/10/02  12:38:56  setzer]
  39.  * 
  40.  *     Fixed several bugs including 855 (plumhall ansi test)
  41.  *     and 708 (the alignment problem). Also implemented many
  42.  *     previously unimplemented macro instructions.
  43.  *    [90/09/27  13:41:34  setzer]
  44.  * 
  45.  * Revision 1.6  90/09/23  16:46:24  devrcs
  46.  *    Updated flags mainly so a nop would be inserted after the ctc1 instruction.
  47.  *    [90/09/12  17:08:41  setzer]
  48.  * 
  49.  *    Fixed register ordering of xori instruction.  Extended all cpu
  50.  *    instruction masks to include MBZ fields.
  51.  *    [90/09/09  07:40:01  gm]
  52.  * 
  53.  *    Fixed floating point bugs.
  54.  *    [90/09/04  15:13:55  setzer]
  55.  * 
  56.  * Revision 1.5  90/08/09  14:31:26  devrcs
  57.  *    Works Well.
  58.  *    [90/08/03  13:03:04  setzer]
  59.  * 
  60.  * Revision 1.4  90/07/06  00:31:56  devrcs
  61.  *    Empty submission: clean up any loose ends
  62.  *    [90/06/29  20:45:43  kim]
  63.  * 
  64.  * $EndLog$
  65.  */
  66. /*
  67.  * mips-opcode.h
  68.  *
  69.  */
  70.  
  71.  
  72. #if !defined(__STDC__) && !defined(const)
  73. #define const
  74. #endif
  75.  
  76. #define INSN_WRITE_GPR_D            0x00000001
  77. #define INSN_WRITE_GPR_S            0x00000002
  78. #define INSN_WRITE_GPR_T            0x00000004
  79. #define INSN_WRITE_GPR_31           0x00000008
  80. #define INSN_WRITE_FPR_D            0x00000010
  81. #define INSN_WRITE_FPR_S            0x00000020
  82. #define INSN_WRITE_FPR_T            0x00000040
  83. #define INSN_READ_GPR_D             0x00000080
  84. #define INSN_READ_GPR_S             0x00000100
  85. #define INSN_READ_GPR_T             0x00000200
  86. #define INSN_READ_GPR_31            0x00000400
  87. #define INSN_READ_FPR_D             0x00000800
  88. #define INSN_READ_FPR_S             0x00001000
  89. #define INSN_READ_FPR_T             0x00002000
  90. #define INSN_TRAP                   0x00004000
  91. #define INSN_COND_CODE              0x00008000
  92. #define INSN_TLB                    0x00010000
  93. #define INSN_RFE                    0x00020000
  94. #define INSN_COP                    0x00040000
  95. #define INSN_LOAD_DELAY             0x00080000
  96. #define INSN_UNCOND_BRANCH_DELAY    0x00100000
  97. #define INSN_COND_BRANCH_DELAY      0x00200000
  98. #define INSN_COPROC_DELAY           0x00400000
  99. #define INSN_STORE_DELAY            0x00800000
  100. #define INSN_EXTRA_DELAY            0x01000000
  101. #define INSN_R4000                0x80000000
  102.  
  103. #define INSN_MACRO                  0xffffffff
  104.  
  105. /* 
  106.  * This is a list of macro expanded instructions. 
  107.  *
  108.  * _I appended means immeadiate
  109.  * _A appended means address
  110.  */
  111. enum {
  112.     M_ABS,
  113.     M_ABSU,
  114.     M_ADD_I,
  115.     M_ADDU_I,
  116.     M_AND_I,
  117.     M_BEQ_I,
  118.     M_BGE,
  119.     M_BGE_I,
  120.     M_BGEU,
  121.     M_BGEU_I,
  122.     M_BGT,
  123.     M_BGT_I,
  124.     M_BGTU,
  125.     M_BGTU_I,
  126.     M_BLE,
  127.     M_BLE_I,
  128.     M_BLEU,
  129.     M_BLEU_I,
  130.     M_BLT,
  131.     M_BLT_I,
  132.     M_BLTU,
  133.     M_BLTU_I,
  134.     M_BNE_I,
  135.     M_DIV_3,
  136.     M_DIV_3I,
  137.     M_DIVU_3,
  138.     M_DIVU_3I,
  139.     M_L_D,
  140.     M_L_DOB,
  141.     M_L_DAB,
  142.     M_LA,
  143.     M_LA_AB,
  144.     M_LB_A,
  145.     M_LB_AB,
  146.     M_LBU_A,
  147.     M_LBU_AB,
  148.     M_LD_A,
  149.     M_LD_OB,
  150.     M_LD_AB,
  151.     M_LH_A,
  152.     M_LH_AB,
  153.     M_LHU_A,
  154.     M_LHU_AB,
  155.     M_LI,
  156.     M_LI_D,
  157.     M_LI_DD,
  158.     M_LS_A,
  159.     M_LW_A,
  160.     M_LW_AB,
  161.     M_LWC0_A,
  162.     M_LWC0_AB,
  163.     M_LWC1_A,
  164.     M_LWC1_AB,
  165.     M_LWC2_A,
  166.     M_LWC2_AB,
  167.     M_LWC3_A,
  168.     M_LWC3_AB,
  169.     M_LWL_A,
  170.     M_LWL_AB,
  171.     M_LWR_A,
  172.     M_LWR_AB,
  173.     M_MUL,
  174.     M_MUL_I, 
  175.     M_MULO,
  176.     M_MULO_I, 
  177.     M_MULOU,
  178.     M_MULOU_I, 
  179.     M_NOR_I,
  180.     M_OR_I,
  181.     M_REM_3,
  182.     M_REM_3I,
  183.     M_REMU_3,
  184.     M_REMU_3I,
  185.     M_ROL,
  186.     M_ROL_I,
  187.     M_ROR,
  188.     M_ROR_I,
  189.     M_S_DA,
  190.     M_S_DOB,
  191.     M_S_DAB,
  192.     M_S_S,
  193.     M_SD_A,
  194.     M_SD_OB,
  195.     M_SD_AB,
  196.     M_SEQ,
  197.     M_SEQ_I,
  198.     M_SGE,
  199.     M_SGE_I,
  200.     M_SGEU,
  201.     M_SGEU_I,
  202.     M_SGT,
  203.     M_SGT_I,
  204.     M_SGTU,
  205.     M_SGTU_I,
  206.     M_SLE,
  207.     M_SLE_I,
  208.     M_SLEU,
  209.     M_SLEU_I,
  210.     M_SLT_I,
  211.     M_SLTU_I,
  212.     M_SNE,
  213.     M_SNE_I,
  214.     M_SB_A,
  215.     M_SB_AB,
  216.     M_SH_A,
  217.     M_SH_AB,
  218.     M_SW_A,
  219.     M_SW_AB,
  220.     M_SWC0_A,
  221.     M_SWC0_AB,
  222.     M_SWC1_A,
  223.     M_SWC1_AB,
  224.     M_SWC2_A,
  225.     M_SWC2_AB,
  226.     M_SWC3_A,
  227.     M_SWC3_AB,
  228.     M_SWL_A,
  229.     M_SWL_AB,
  230.     M_SWR_A,
  231.     M_SWR_AB,
  232.     M_SUB_I,
  233.     M_SUBU_I,
  234.     M_TRUNCWD,
  235.     M_TRUNCWS,
  236.     M_ULH,
  237.     M_ULH_A,
  238.     M_ULHU,
  239.     M_ULHU_A,
  240.     M_ULW,
  241.     M_ULW_A,
  242.     M_USH,
  243.     M_USH_A,
  244.     M_USW,
  245.     M_USW_A,
  246.     M_XOR_I
  247. };
  248.  
  249. /*
  250.  
  251. Kinds of operands:
  252.  
  253.     a   -   26 bit address
  254.     b   -   base register
  255.     c   -   break code
  256.     d   -   destination register
  257.     i   -   16 bit unsigned immediate
  258.     j   -   16 bit signed immediate
  259.     o   -   16 bit offset
  260.     p   -   pc relative offset
  261.     s   -   source register
  262.     t   -   target register
  263.     r   -   both source and target register
  264.     v   -   both source and destination register
  265.     w   -   both target and destination register
  266.     u   -   upper 16 bits
  267.     x   -   temporary register (usually $at).
  268.  
  269.     D   -   floating point destination register
  270.     S   -   floating point source register
  271.     T   -   floating point target register
  272.     V   -   both floating source and destination register
  273.     W   -   both floating target and destination register
  274.     I   -   32 bit immediate (built in macro instrs only)
  275.  
  276.     F   -   Floating point constant (li.d only).
  277.  
  278.     <   -   Shift constant
  279.  
  280. */
  281.  
  282.  
  283. /* Short hand so the lines aren't too long. */
  284. /* ANY_DELAY is used in mips.c to determine if we need to add
  285.    nop's in the delay slots */
  286.  
  287. /* load delays */
  288. #define LDD     INSN_LOAD_DELAY
  289.  
  290. /* branch delays */
  291. #define BD      INSN_UNCOND_BRANCH_DELAY|INSN_COND_BRANCH_DELAY
  292.  
  293. /* coprocessor delays */
  294. #define COD     INSN_COPROC_DELAY
  295.  
  296. /* instructions that require and extra delay */
  297. #define EXD     INSN_EXTRA_DELAY
  298.  
  299. #define ANY_DELAY (LDD|BD|COD|EXD)
  300.                   
  301.  
  302. /* None of these are ever referenced in the code??? */
  303. /* There is really no need to distinguish between ALL these 
  304.    different types of load delays ...USE THE ABOVE MACROS INSTEAD*/
  305. #define WR_d    INSN_WRITE_GPR_D
  306. #define WR_s    INSN_WRITE_GPR_S
  307. #define WR_t    INSN_WRITE_GPR_T
  308. #define WR_31   INSN_WRITE_GPR_31       
  309. #define WR_D    INSN_WRITE_FPR_D        
  310. #define WR_S    INSN_WRITE_FPR_S        
  311. #define WR_T    INSN_WRITE_FPR_T        
  312. #define RD_d    INSN_READ_GPR_D         
  313. #define RD_s    INSN_READ_GPR_S         
  314. #define RD_b    INSN_READ_GPR_S         
  315. #define RD_t    INSN_READ_GPR_T         
  316. #define ST_t    INSN_READ_GPR_T         
  317. #define RD_31   INSN_READ_GPR_31        
  318. #define RD_D    INSN_READ_FPR_D         
  319. #define RD_S    INSN_READ_FPR_S         
  320. #define RD_T    INSN_READ_FPR_T         
  321. #define CC      (INSN_COND_CODE|INSN_LOAD_DELAY)
  322. #define ST_T    INSN_READ_FPR_T         
  323. #define ST_C0   INSN_COP
  324. #define ST_C1   INSN_READ_FPR_T         
  325. #define ST_C2   INSN_COP
  326. #define ST_C3   INSN_COP
  327. #define RD_C0   INSN_COP
  328. #define RD_C1   INSN_READ_FPR_T         
  329. #define RD_C2   INSN_COP
  330. #define RD_C3   INSN_COP
  331. #define WR_C0   INSN_COP
  332. #define WR_C1   INSN_READ_FPR_T         
  333. #define WR_C2   INSN_COP
  334. #define WR_C3   INSN_COP
  335.  
  336.  
  337. /*  
  338.     The order of overloaded instructions matters.
  339.   Label arguments and register arguments look
  340.   the same. Instructions that can have either for arguments
  341.   must apear in the correct order in this table for the assembler
  342.   to pick the right one. In other words, entries with immediate
  343.   operands must apear after the same instruction with registers.
  344.     Many instructions are short hand for other instructions
  345.   (i.e., The jal <register> instruction is short for jalr <register>).
  346. */
  347.  
  348. static const struct mips_opcode mips_opcodes[] = {
  349. {"abs",     "d,v",    0,    (int) M_ABS,    INSN_MACRO    },
  350. {"abs.s",   "D,V",    0x46000005, 0xffff003f,    WR_D|RD_S    },
  351. {"abs.d",   "D,V",    0x46200005, 0xffff003f,    WR_D|RD_S    },
  352. {"absu",    "d,s",    0,    (int) M_ABSU,    INSN_MACRO    },
  353. {"add",     "d,v,t",    0x00000020, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  354. {"add",     "t,r,I",    0,    (int) M_ADD_I,    INSN_MACRO    },
  355. {"add.s",   "D,V,T",    0x46000000, 0xfff0003f,    WR_D|RD_S|RD_T    },
  356. {"add.d",   "D,V,T",    0x46200000, 0xfff0003f,    WR_D|RD_S|RD_T    },
  357. {"addi",    "t,r,j",    0x20000000, 0xfe000000,    WR_t|RD_s    },
  358. {"addiu",   "t,r,j",    0x24000000, 0xfc000000,    WR_t|RD_s    },
  359. {"addu",    "d,v,t",    0x00000021, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  360. {"addu",    "t,r,I",    0,    (int) M_ADDU_I,    INSN_MACRO    },
  361. {"and",     "d,v,t",    0x00000024, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  362. {"and",     "t,r,I",    0,    (int) M_AND_I,    INSN_MACRO    },
  363. {"andi",    "t,r,i",    0x30000000, 0xfc000000,    WR_t|RD_s    },
  364. {"b",       "p",    0x10000000, 0xfc000000,    BD|RD_s|RD_t    }, /* beq 0,0 */
  365. {"bal",     "p",    0x04110000, 0xfc1f0000,    BD|RD_s        }, /* bgezal 0 */
  366. {"bc0f",    "p",    0x41000000, 0xffff0000,    BD        },
  367. {"bc1f",    "p",    0x45000000, 0xffff0000,    BD        },
  368. {"bc2f",    "p",    0x49000000, 0xffff0000,    BD        },
  369. {"bc3f",    "p",    0x4d000000, 0xffff0000,    BD        },
  370. {"bc0t",    "p",    0x41010000, 0xffff0000,    BD        },
  371. {"bc1t",    "p",    0x45010000, 0xffff0000,    BD        },
  372. {"bc2t",    "p",    0x49010000, 0xffff0000,    BD        },
  373. {"bc3t",    "p",    0x4d010000, 0xffff0000,    BD        },
  374. {"beq",     "s,t,p",    0x10000000, 0xfc000000,    BD|RD_s|RD_t    },
  375. {"beq",     "s,I,p",    0,    (int) M_BEQ_I,    INSN_MACRO    },
  376. {"beqz",    "s,p",    0x10000000, 0xfc000000,    BD|RD_s|RD_t    },
  377. {"bge",     "s,t,p",    0,    (int) M_BGE,    INSN_MACRO    },
  378. {"bge",     "s,I,p",    0,    (int) M_BGE_I,    INSN_MACRO    },
  379. {"bgeu",    "s,t,p",    0,    (int) M_BGEU,    INSN_MACRO    },
  380. {"bgeu",    "s,I,p",    0,    (int) M_BGEU_I,    INSN_MACRO    },
  381. {"bgez",    "s,p",    0x04010000, 0xfc0f0000,    BD|RD_s        },
  382. {"bgezal",  "s,p",    0x04110000, 0xfc1f0000,    BD|RD_s        },
  383. {"bgt",     "s,t,p",    0,    (int) M_BGT,    INSN_MACRO    },
  384. {"bgt",     "s,I,p",    0,    (int) M_BGT_I,    INSN_MACRO    },
  385. {"bgtu",    "s,t,p",    0,    (int) M_BGTU,    INSN_MACRO    },
  386. {"bgtu",    "s,I,p",    0,    (int) M_BGTU_I,    INSN_MACRO    },
  387. {"bgtz",    "s,p",    0x1c000000, 0xfc000000,    BD|RD_s        },
  388. {"ble",     "s,t,p",    0,    (int) M_BLE,    INSN_MACRO    },
  389. {"ble",     "s,I,p",    0,    (int) M_BLE_I,    INSN_MACRO    },
  390. {"bleu",    "s,t,p",    0,    (int) M_BLEU,    INSN_MACRO    },
  391. {"bleu",    "s,I,p",    0,    (int) M_BLEU_I,    INSN_MACRO    },
  392. {"blez",    "s,p",    0x18000000, 0xfc000000,    BD|RD_s        },
  393. {"blt",     "s,t,p",    0,    (int) M_BLT,    INSN_MACRO    },
  394. {"blt",     "s,I,p",    0,    (int) M_BLT_I,    INSN_MACRO    },
  395. {"bltu",    "s,t,p",    0,    (int) M_BLTU,    INSN_MACRO    },
  396. {"bltu",    "s,I,p",    0,    (int) M_BLTU_I,    INSN_MACRO    },
  397. {"bltz",    "s,p",    0x04000000, 0xfc0f0000,    BD|RD_s        },
  398. {"bltzal",  "s,p",    0x04100000, 0xfc1f0000,    BD|RD_s        },
  399. {"bne",     "s,t,p",    0x14000000, 0xfc000000,    BD|RD_s|RD_t    },
  400. {"bne",     "s,I,p",    0,    (int) M_BNE_I,    INSN_MACRO    },
  401. {"bnez",    "s,p",    0x14000000, 0xfc000000,    BD|RD_s|RD_t    },
  402. {"break",   "",        0x0000000d, 0xffffffff,    INSN_TRAP    },
  403. {"break",   "c",    0x0000000d, 0xffffffff,    INSN_TRAP    },
  404. {"c.f.d",   "S,T",    0x46200030, 0xfff003ff,    RD_S|RD_T|CC    },
  405. {"c.f.s",   "S,T",    0x46000030, 0xfff003ff,    RD_S|RD_T|CC    },
  406. {"c.un.d",  "S,T",    0x46200031, 0xfff003ff,    RD_S|RD_T|CC    },
  407. {"c.un.s",  "S,T",    0x46000031, 0xfff003ff,    RD_S|RD_T|CC    },
  408. {"c.eq.d",  "S,T",    0x46200032, 0xfff003ff,    RD_S|RD_T|CC    },
  409. {"c.eq.s",  "S,T",    0x46000032, 0xfff003ff,    RD_S|RD_T|CC    },
  410. {"c.ueq.d", "S,T",    0x46200033, 0xfff003ff,    RD_S|RD_T|CC    },
  411. {"c.ueq.s", "S,T",    0x46000033, 0xfff003ff,    RD_S|RD_T|CC    },
  412. {"c.olt.d", "S,T",    0x46200034, 0xfff003ff,    RD_S|RD_T|CC    },
  413. {"c.olt.s", "S,T",    0x46000034, 0xfff003ff,    RD_S|RD_T|CC    },
  414. {"c.ult.d", "S,T",    0x46200035, 0xfff003ff,    RD_S|RD_T|CC    },
  415. {"c.ult.s", "S,T",    0x46000035, 0xfff003ff,    RD_S|RD_T|CC    },
  416. {"c.ole.d", "S,T",    0x46200036, 0xfff003ff,    RD_S|RD_T|CC    },
  417. {"c.ole.s", "S,T",    0x46000036, 0xfff003ff,    RD_S|RD_T|CC    },
  418. {"c.ule.d", "S,T",    0x46200037, 0xfff003ff,    RD_S|RD_T|CC    },
  419. {"c.ule.s", "S,T",    0x46000037, 0xfff003ff,    RD_S|RD_T|CC    },
  420. {"c.sf.d",  "S,T",    0x46200038, 0xfff003ff,    RD_S|RD_T|CC    },
  421. {"c.sf.s",  "S,T",    0x46000038, 0xfff003ff,    RD_S|RD_T|CC    },
  422. {"c.ngle.d","S,T",    0x46200039, 0xfff003ff,    RD_S|RD_T|CC    },
  423. {"c.ngle.s","S,T",    0x46000039, 0xfff003ff,    RD_S|RD_T|CC    },
  424. {"c.seq.d", "S,T",    0x4620003a, 0xfff003ff,    RD_S|RD_T|CC    },
  425. {"c.seq.s", "S,T",    0x4600003a, 0xfff003ff,    RD_S|RD_T|CC    },
  426. {"c.ngl.d", "S,T",    0x4620003b, 0xfff003ff,    RD_S|RD_T|CC    },
  427. {"c.ngl.s", "S,T",    0x4600003b, 0xfff003ff,    RD_S|RD_T|CC    },
  428. {"c.lt.d",  "S,T",    0x4620003c, 0xfff003ff,    RD_S|RD_T|CC    },
  429. {"c.lt.s",  "S,T",    0x4600003c, 0xfff003ff,    RD_S|RD_T|CC    },
  430. {"c.nge.d", "S,T",    0x4620003d, 0xfff003ff,    RD_S|RD_T|CC    },
  431. {"c.nge.s", "S,T",    0x4600003d, 0xfff003ff,    RD_S|RD_T|CC    },
  432. {"c.le.d",  "S,T",    0x4620003e, 0xfff003ff,    RD_S|RD_T|CC    },
  433. {"c.le.s",  "S,T",    0x4600003e, 0xfff003ff,    RD_S|RD_T|CC    },
  434. {"c.ngt.d", "S,T",    0x4620003f, 0xfff003ff,    RD_S|RD_T|CC    },
  435. {"c.ngt.s", "S,T",    0x4600003f, 0xfff003ff,    RD_S|RD_T|CC    },
  436. #if 0
  437. /* these are not very safe to use, no bounds checking. */
  438. {"c0",      "I",    0x42000000, 0xfff00000,    0        },
  439. {"c1",      "I",    0x46000000, 0xfff00000,    0        },
  440. {"c2",      "I",    0x4a000000, 0xfff00000,    0        },
  441. {"c3",      "I",    0x4e000000, 0xfff00000,    0        },
  442. #endif
  443. {"cfc0",    "t,d",    0x40400000, 0xfff00000,    COD|RD_d    },
  444. {"cfc1",    "t,d",    0x44400000, 0xfff00000,    COD|RD_S    },
  445. {"cfc1",    "t,S",    0x44400000, 0xfff00000,    COD|RD_S    },
  446. {"cfc2",    "t,d",    0x48400000, 0xfff00000,    COD|RD_d    },
  447. {"cfc3",    "t,d",    0x4c400000, 0xfff00000,    COD|RD_d    },
  448. {"ctc0",    "t,d",    0x40c00000, 0xfff00000,    COD|RD_t|RD_d    },
  449. {"ctc1",    "t,d",    0x44c00000, 0xfff00000,    COD|RD_t    },
  450. {"ctc1",    "t,S",    0x44c00000, 0xfff00000,    COD|RD_t    },
  451. {"ctc2",    "t,d",    0x48c00000, 0xfff00000,    COD|RD_t|RD_d    },
  452. {"ctc3",    "t,d",    0x4cc00000, 0xfff00000,    COD|RD_t|RD_d    },
  453. {"cvt.d.s", "D,S",    0x46000021, 0xfff0003f,    WR_D|RD_S    },
  454. {"cvt.d.w", "D,S",    0x46800021, 0xfff0003f,    WR_D|RD_S    },
  455. {"cvt.s.d", "D,S",    0x46200020, 0xfff0003f,    WR_D|RD_S    },
  456. {"cvt.s.w", "D,S",    0x46800020, 0xfff0003f,    WR_D|RD_S    },
  457. {"cvt.w.d", "D,S",    0x46200024, 0xfff0003f,    WR_D|RD_S    },
  458. {"cvt.w.s", "D,S",    0x46000024, 0xfff0003f,    WR_D|RD_S    },
  459. {"div",     "s,t",    0x0000001a, 0xfc00003f,    RD_s|RD_t|EXD    },
  460. {"div",     "d,s,t",    0,    (int) M_DIV_3,    INSN_MACRO    },
  461. {"div",     "d,v,I",    0,    (int) M_DIV_3I,    INSN_MACRO    },
  462. {"div.d",   "D,V,T",    0x46200003, 0xfff0003f,    WR_D|RD_S|RD_T    },
  463. {"div.s",   "D,V,T",    0x46000003, 0xfff0003f,    WR_D|RD_S|RD_T    },
  464. {"divu",    "s,t",    0x0000001b, 0xfc00ffff,    RD_s|RD_t|EXD    },
  465. {"divu",    "d,s,t",    0,    (int) M_DIVU_3,    INSN_MACRO    },
  466. {"divu",    "d,v,I",    0,    (int) M_DIVU_3I,    INSN_MACRO    },
  467. {"j",       "s",    0x00000008, 0xfc1fffff,    BD|RD_s        },
  468. {"j",       "a",    0x08000000, 0xfc000000,    BD        },
  469. {"jal",     "d,s",    0x00000009, 0xfc1f07ff,    BD|RD_s|WR_d    },/* jalr */
  470. {"jal",     "s",    0x0000f809, 0xfc00ff3f,    BD|RD_s|WR_d    },/* jalr $ra */
  471. {"jal",     "a",    0x0c000000, 0xfc000000,    BD|WR_31    },
  472. {"jalr",    "s",    0x0000f809, 0xfc00f83f,    BD|RD_s|WR_31    },
  473. {"jalr",    "d,s",    0x00000009, 0xfc1f07ff,    BD|RD_s|WR_d    },
  474. {"jr",      "s",    0x00000008, 0xfc1fffff,    BD|RD_s        },
  475. {"l.d",     "T,o(b)",    0,    (int) M_L_DOB,    INSN_MACRO    },
  476. {"l.d",     "T,A(b)",    0,    (int) M_L_DAB,    INSN_MACRO    },
  477. {"l.s",     "T,o(b)",    0xc4000000, 0xfc000000,    COD|RD_b    }, /* lwc1 */
  478. {"l.s",     "T,A(b)",    0,    (int) M_LWC1_AB,    INSN_MACRO    },
  479. {"la",      "t,A",    0,    (int) M_LA,    INSN_MACRO    },
  480. {"la",      "t,A(b)",    0,    (int) M_LA_AB,    INSN_MACRO    },
  481. {"lb",      "t,o(b)",    0x80000000, 0xfc000000,    LDD|RD_b    },
  482. {"lb",      "t,A(b)",    0,    (int) M_LB_AB,    INSN_MACRO    },
  483. {"lbu",     "t,o(b)",    0x90000000, 0xfc000000,    LDD|RD_b    },
  484. {"lbu",     "t,A(b)",    0,    (int) M_LBU_AB,    INSN_MACRO    },
  485. {"ld",      "t,o(b)",    0,    (int) M_LD_OB,    INSN_MACRO    },
  486. {"ld",      "t,A(b)",    0,    (int) M_LD_AB,    INSN_MACRO    },
  487. {"lh",      "t,o(b)",    0x84000000, 0xfc000000,    LDD|RD_b    },
  488. {"lh",      "t,A(b)",    0,    (int) M_LH_AB,    INSN_MACRO    },
  489. {"lhu",     "t,o(b)",    0x94000000, 0xfc000000,    LDD|RD_b    },
  490. {"lhu",     "t,A(b)",    0,    (int) M_LHU_AB,    INSN_MACRO    },
  491. {"li",      "t,I",    0,    (int) M_LI,    INSN_MACRO    },
  492. {"li.d",    "t,F",    0,    (int) M_LI_D,    INSN_MACRO    },
  493. {"li.d",    "S,F",    0,    (int) M_LI_DD,    INSN_MACRO    },
  494. {"lui",     "t,u",    0x3c000000, 0xfff00000,    WR_t        },
  495. {"lw",      "t,o(b)",    0x8c000000, 0xfc000000,    LDD|RD_b    },
  496. {"lw",      "t,A(b)",    0,    (int) M_LW_AB,    INSN_MACRO    },
  497. {"lwc0",    "t,o(b)",    0xc0000000, 0xfc000000,    COD|RD_b    },
  498. {"lwc0",    "t,A(b)",    0,    (int) M_LWC0_AB,    INSN_MACRO    },
  499. {"lwc1",    "T,o(b)",    0xc4000000, 0xfc000000,    COD|RD_b    },
  500. {"lwc1",    "T,A(b)",    0,    (int) M_LWC1_AB,    INSN_MACRO    },
  501. {"lwc2",    "t,o(b)",    0xc8000000, 0xfc000000,    COD|RD_b    },
  502. {"lwc2",    "t,A(b)",    0,    (int) M_LWC2_AB,    INSN_MACRO    },
  503. {"lwc3",    "t,o(b)",    0xcc000000, 0xfc000000,    COD|RD_b    },
  504. {"lwc3",    "t,A(b)",    0,    (int) M_LWC3_AB,    INSN_MACRO    },
  505. {"lwl",     "t,o(b)",    0x88000000, 0xfc000000,    LDD|RD_b    },
  506. {"lwl",     "t,A(b)",    0,    (int) M_LWL_AB,    INSN_MACRO    },
  507. {"lwr",     "t,o(b)",    0x98000000, 0xfc000000,    LDD|RD_b    },
  508. {"lwr",     "t,A(b)",    0,    (int) M_LWR_AB,    INSN_MACRO    },
  509. {"mfc0",    "t,d",    0x40000000, 0xfff007ff,    COD|WR_t|RD_C0    },
  510. {"mfc1",    "t,S",    0x44000000, 0xfff007ff,    COD|RD_S    },
  511. {"mfc1",    "t,d",    0x44000000, 0xfff007ff,    COD|RD_C1    },
  512. {"mfc2",    "t,d",    0x48000000, 0xfff007ff,    COD|WR_t|RD_C2    },
  513. {"mfc3",    "t,d",    0x4c000000, 0xfff007ff,    COD|WR_t|RD_C3    },
  514. {"mfhi",    "d",    0x00000010, 0xffff07ff,    WR_d|EXD    },
  515. {"mflo",    "d",    0x00000012, 0xffff07ff,    WR_d|EXD    },
  516. {"mov.d",   "D,S",    0x46200006, 0xfff0003f,    WR_t|RD_S    },
  517. {"mov.s",   "D,S",    0x46000006, 0xfff0003f,    WR_t|RD_S    },
  518. {"move",    "d,s",    0x00000021, 0xfc1f07ff,    WR_d|RD_s    }, /* addu */
  519. {"mtc0",    "t,d",    0x40800000, 0xfff007ff,    COD|RD_t|WR_C0    },
  520. {"mtc1",    "t,d",    0x44800000, 0xfff007ff,    COD|RD_t|WR_C1    },
  521. {"mtc1",    "t,S",    0x44800000, 0xfff007ff,    COD|RD_t    },
  522. {"mtc2",    "t,d",    0x48800000, 0xfff007ff,    COD|RD_t|WR_C2    },
  523. {"mtc3",    "t,d",    0x4c800000, 0xfff007ff,    COD|RD_t|WR_C3    },
  524. {"mthi",    "s",    0x00000011, 0xfc1fffff,    RD_s|EXD    },
  525. {"mtlo",    "s",    0x00000013, 0xfc1fffff,    RD_s|EXD    },
  526. {"mul.d",   "D,V,T",    0x46200002, 0xfff0003f,    WR_D|RD_S|RD_T    },
  527. {"mul.s",   "D,V,T",    0x46000002, 0xfff0003f,    WR_D|RD_S|RD_T    },
  528. {"mul",     "d,v,t",    0,    (int) M_MUL,    INSN_MACRO    },
  529. {"mul",     "d,v,I",    0,    (int) M_MUL_I,    INSN_MACRO    },
  530. {"mulo",    "d,v,t",    0,    (int) M_MULO,    INSN_MACRO    },
  531. {"mulo",    "d,v,I",    0,    (int) M_MULO_I,    INSN_MACRO    },
  532. {"mulou",   "d,v,t",    0,    (int) M_MULOU,    INSN_MACRO    },
  533. {"mulou",   "d,v,I",    0,    (int) M_MULOU_I,    INSN_MACRO    },
  534. {"mult",    "s,t",    0x00000018, 0xfc00ffff,    RD_s|RD_t|EXD    },
  535. {"multu",   "s,t",    0x00000019, 0xfc00ffff,    RD_s|RD_t|EXD    },
  536. {"neg",     "d,w",    0x00000022, 0xfc0007ff,    WR_d|RD_s|RD_t    }, /* sub    0 */
  537. {"negu",    "d,w",    0x00000023, 0xfc0007ff,    WR_d|RD_s|RD_t    }, /* subu    0 */
  538. {"neg.d",   "D,V",    0x46200007, 0xfff0003f,    WR_D|RD_S    },
  539. {"neg.s",   "D,V",    0x46000007, 0xfff0003f,    WR_D|RD_S    },
  540. {"nop",     "",        0x00000000, 0xffffffff,    0        },
  541. {"nor",     "d,v,t",    0x00000027, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  542. {"nor",     "d,v,I",    0,    (int) M_NOR_I,    INSN_MACRO    },
  543. {"not",     "d,v",    0x00000027, 0xfc0007ff,    WR_d|RD_s|RD_t    }, /* nor d,s,zero */
  544. {"or",      "d,v,t",    0x00000025, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  545. {"or",      "t,r,I",    0,    (int) M_OR_I,    INSN_MACRO    },
  546. {"ori",     "t,r,i",    0x34000000, 0xfc000000,    WR_t|RD_s    },
  547. {"rem",     "d,v,t",    0,    (int) M_REM_3,    INSN_MACRO    },
  548. {"rem",     "d,v,I",    0,    (int) M_REM_3I,    INSN_MACRO    },
  549. {"remu",    "d,v,t",    0,    (int) M_REMU_3,    INSN_MACRO    },
  550. {"remu",    "d,v,I",    0,    (int) M_REMU_3I,    INSN_MACRO    },
  551. {"rfe",     "",        0x42000010, 0xffffffff,    INSN_RFE    },
  552. {"rol",     "d,v,t",    0,    (int) M_ROL,    INSN_MACRO    },
  553. {"rol",     "d,v,I",    0,    (int) M_ROL_I,    INSN_MACRO    },
  554. {"ror",     "d,v,t",    0,    (int) M_ROR,    INSN_MACRO    },
  555. {"ror",     "d,v,I",    0,    (int) M_ROR_I,    INSN_MACRO    },
  556. {"s.d",     "T,o(b)",    0,    (int) M_S_DOB,    INSN_MACRO    },
  557. {"s.d",     "T,A(b)",    0,    (int) M_S_DAB,    INSN_MACRO    },
  558. {"s.s",     "T,o(b)",    0xe4000000, 0xfc000000,    ST_T|RD_b    }, /* swc1 */
  559. {"s.s",     "T,A(b)",    0,    (int) M_SWC1_AB,    INSN_MACRO    },
  560. {"sb",      "t,o(b)",    0xa0000000, 0xfc000000,    ST_t|RD_b    },
  561. {"sb",      "t,A(b)",    0,    (int) M_SB_AB,    INSN_MACRO    },
  562. {"sd",      "t,o(b)",    0,    (int) M_SD_OB,    INSN_MACRO    },
  563. {"sd",      "t,A(b)",    0,    (int) M_SD_AB,    INSN_MACRO    },
  564. {"seq",     "d,v,t",    0,    (int) M_SEQ,    INSN_MACRO    },
  565. {"seq",     "d,v,I",    0,    (int) M_SEQ_I,    INSN_MACRO    },
  566. {"sge",     "d,v,t",    0,    (int) M_SGE,    INSN_MACRO    },
  567. {"sge",     "d,v,I",    0,    (int) M_SGE_I,    INSN_MACRO    },
  568. {"sgeu",    "d,v,t",    0,    (int) M_SGEU,    INSN_MACRO    },
  569. {"sgeu",    "d,v,I",    0,    (int) M_SGEU_I,    INSN_MACRO    },
  570. {"sgt",     "d,v,t",    0,    (int) M_SGT,    INSN_MACRO    },
  571. {"sgt",     "d,v,I",    0,    (int) M_SGT_I,    INSN_MACRO    },
  572. {"sgtu",    "d,v,t",    0,    (int) M_SGTU,    INSN_MACRO    },
  573. {"sgtu",    "d,v,I",    0,    (int) M_SGTU_I,    INSN_MACRO    },
  574. {"sh",      "t,o(b)",    0xa4000000, 0xfc000000,    ST_t|RD_b    },
  575. {"sh",      "t,A(b)",    0,    (int) M_SH_AB,    INSN_MACRO    },
  576. {"sle",     "d,v,t",    0,    (int) M_SLE,    INSN_MACRO    },
  577. {"sle",     "d,v,I",    0,    (int) M_SLE_I,    INSN_MACRO    },
  578. {"sleu",    "d,v,t",    0,    (int) M_SLEU,    INSN_MACRO    },
  579. {"sleu",    "d,v,I",    0,    (int) M_SLEU_I,    INSN_MACRO    },
  580. {"sll",     "d,w,s",    0x00000004, 0xfc0007ff,    WR_d|RD_t|RD_s    }, /* sllv */
  581. {"sll",     "d,w,<",    0x00000000, 0xffe0003f,    WR_d|RD_t    },
  582. {"sllv",    "d,t,s",    0x00000004, 0xfc0007ff,    WR_d|RD_t|RD_s    },
  583. {"slt",     "d,v,t",    0x0000002a, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  584. {"slt",     "d,v,I",    0,    (int) M_SLT_I,    INSN_MACRO    },
  585. {"slti",    "t,r,j",    0x28000000, 0xfc000000,    WR_t|RD_s    },
  586. {"sltiu",   "t,r,j",    0x2c000000, 0xfc000000,    WR_t|RD_s    },
  587. {"sltu",    "d,v,t",    0x0000002b, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  588. {"sltu",    "d,v,I",    0,    (int) M_SLTU_I,    INSN_MACRO    },
  589. {"sne",     "d,v,t",    0,    (int) M_SNE,    INSN_MACRO    },
  590. {"sne",     "d,v,I",    0,    (int) M_SNE_I,    INSN_MACRO    },
  591. {"sra",     "d,w,s",    0x00000007, 0xfc0007ff,    WR_d|RD_t|RD_s    }, /* srav */
  592. {"sra",     "d,w,<",    0x00000003, 0xffe0003f,    WR_t|RD_d    },
  593. {"srav",    "d,t,s",    0x00000007, 0xfc0007ff,    WR_d|RD_t|RD_s    },
  594. {"srl",     "d,w,s",    0x00000006, 0xfc0007ff,    WR_d|RD_t|RD_s    }, /* srlv */
  595. {"srl",     "d,w,<",    0x00000002, 0xffe0003f,    WR_d|RD_t    },
  596. {"srlv",    "d,t,s",    0x00000006, 0xfc0007ff,    WR_d|RD_t|RD_s    },
  597. {"sub",     "d,v,t",    0x00000022, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  598. {"sub",     "d,v,I",    0,    (int) M_SUB_I,    INSN_MACRO    },
  599. {"sub.d",   "D,V,T",    0x46200001, 0xfff0003f,    WR_D|RD_S|RD_T    },     
  600. {"sub.s",   "D,V,T",    0x46000001, 0xfff0003f,    WR_D|RD_S|RD_T    },
  601. {"subu",    "d,v,t",    0x00000023, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  602. {"subu",    "d,v,I",    0,    (int) M_SUBU_I,    INSN_MACRO    },
  603. {"sw",      "t,o(b)",    0xac000000, 0xfc000000,    ST_t|RD_b    },
  604. {"sw",      "t,A(b)",    0,    (int) M_SW_AB,    INSN_MACRO    },
  605. {"swc0",    "t,o(b)",    0xe0000000, 0xfc000000,    ST_C0|RD_b    },
  606. {"swc0",    "t,A(b)",    0,    (int) M_SWC0_AB,    INSN_MACRO    },
  607. {"swc1",    "t,o(b)",    0xe4000000, 0xfc000000,    ST_C1|RD_b    },
  608. {"swc1",    "T,o(b)",    0xe4000000, 0xfc000000,    ST_T|RD_b    },
  609. {"swc1",    "T,A(b)",    0,    (int) M_SWC1_AB,    INSN_MACRO    },
  610. {"swc2",    "t,o(b)",    0xe8000000, 0xfc000000,    ST_C2|RD_b    },
  611. {"swc2",    "t,A(b)",    0,    (int) M_SWC2_AB,    INSN_MACRO    },
  612. {"swc3",    "t,o(b)",    0xec000000, 0xfc000000,    ST_C3|RD_b    },
  613. {"swc3",    "t,A(b)",    0,    (int) M_SWC3_AB,    INSN_MACRO    },
  614. {"swl",     "t,o(b)",    0xa8000000, 0xfc000000,    ST_t|RD_b    },
  615. {"swl",     "t,A(b)",    0,    (int) M_SWL_AB,    INSN_MACRO    },
  616. {"swr",     "t,o(b)",    0xb8000000, 0xfc000000,    ST_t|RD_b    },
  617. {"swr",     "t,A(b)",    0,    (int) M_SWR_AB,    INSN_MACRO    },
  618. {"syscall", "",        0x0000000c, 0xffffffff,    INSN_TRAP    },
  619. {"tlbp",    "",        0x42000008, 0xffffffff,    INSN_TLB    },
  620. {"tlbr",    "",        0x42000001, 0xffffffff,    INSN_TLB    },
  621. {"tlbwi",   "",        0x42000002, 0xffffffff,    INSN_TLB    },
  622. {"tlbwr",   "",        0x42000006, 0xffffffff,    INSN_TLB    },
  623. {"trunc.w.d", "D,S,t",    0,    (int) M_TRUNCWD,    INSN_MACRO    },
  624. {"trunc.w.s", "D,S,t",    0,    (int) M_TRUNCWS,    INSN_MACRO    },
  625. {"ulh",     "t,o(b)",    0,    (int) M_ULH,    INSN_MACRO    },
  626. {"ulh",     "t,A",    0,    (int) M_ULH_A,    INSN_MACRO    },
  627. {"ulhu",    "t,o(b)",    0,    (int) M_ULHU,    INSN_MACRO    },
  628. {"ulhu",    "t,A",    0,    (int) M_ULHU_A,    INSN_MACRO    },
  629. {"ulw",     "t,o(b)",    0,    (int) M_ULW,    INSN_MACRO    },
  630. {"ulw",     "t,A",    0,    (int) M_ULW_A,    INSN_MACRO    },
  631. {"ush",     "t,o(b)",    0,    (int) M_USH,    INSN_MACRO    },
  632. {"ush",     "t,A",    0,    (int) M_USH_A,    INSN_MACRO    },
  633. {"usw",     "t,o(b)",    0,    (int) M_USW,    INSN_MACRO    },
  634. {"usw",     "t,A",    0,    (int) M_USW_A,    INSN_MACRO    },
  635. {"xor",     "d,v,t",    0x00000026, 0xfc0007ff,    WR_d|RD_s|RD_t    },
  636. {"xor",     "t,r,I",    0,    (int) M_XOR_I,    INSN_MACRO    },
  637. {"xori",    "t,r,i",    0x38000000, 0xfc000000,    WR_t|RD_s    },
  638. };
  639.  
  640. #define NUMOPCODES          (sizeof(mips_opcodes)/sizeof(*mips_opcodes))
  641.  
  642. #if 0
  643. int
  644. main(void)
  645. {
  646.     int i;
  647.  
  648.     for (i = 0; i < NUMOPCODES; ++i) {
  649.     if ((mips_opcodes[i].mask & mips_opcodes[i].match) !=
  650.         mips_opcodes[i].match) {
  651.         printf("error i = %d, opcode= %s\n", i, mips_opcodes[i].name);
  652.         }
  653.     }
  654.     return 0;
  655. }
  656. #endif
  657.